package com.song.JavaThread_day04.ch4_11;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

public class ReportGenerator implements Callable<String>{
	
	
	private String sender;
	
	private String title;
	
	
	
	public ReportGenerator(String sender, String title) {
		super();
		this.sender = sender;
		this.title = title;
	}



	@Override
	public String call() throws Exception {
		
		long duration =(long)(Math.random() *10);
		System.out.printf(" %s_%s :reportgenerator :generating a report during %d seconds \n",this.sender,this.title,duration);
		TimeUnit.SECONDS.sleep(duration);
		String ret =sender+" : "+ title;
		return ret;
	}

}
